var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * 定义一个类
 * get set 存取器
 */
var Person = /** @class */ (function () {
    function Person() {
    }
    Person.prototype.getName = function () {
        console.log(this.name);
    };
    return Person;
}());
//get set
var Person2 = /** @class */ (function () {
    function Person2(myname) {
        this.myname = myname;
    }
    Object.defineProperty(Person2.prototype, "name", {
        //获取name属性的值
        get: function () {
            return this.myname;
        },
        set: function (newVal) {
            this.myname = newVal;
        },
        enumerable: true,
        configurable: true
    });
    return Person2;
}());
var p2 = new Person2('zhufeng');
console.log(p2.name);
p2.name = 'jiagou';
//参数的属性
//加上了public之后就相当于给当前类的实例增加了一个公有属性
//public private protected
var Person3 = /** @class */ (function () {
    function Person3(myname) {
        this.myname = myname;
    }
    return Person3;
}());
//readonly只读
var Person4 = /** @class */ (function () {
    function Person4(id) {
        this.id = id;
    }
    return Person4;
}());
var p4 = new Person4(1);
console.log(p4.id);
//p4.id = 2;
//父类 子类 其它的地方
var Parent = /** @class */ (function () {
    function Parent(name, age, money) {
        this.name = name;
        this.age = age;
        this.money = money;
    }
    Parent.prototype.getName = function () {
        console.log('父类 getName:' + this.name);
    };
    Parent.prototype.getAge = function () {
        console.log('父类 getAge:' + this.age);
    };
    Parent.prototype.getMoney = function () {
        console.log('父类 getMoney:' + this.money);
    };
    return Parent;
}());
var Child = /** @class */ (function (_super) {
    __extends(Child, _super);
    function Child() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Child.prototype.getName = function () {
        console.log('子类:' + this.name);
    };
    Child.prototype.getAge = function () {
        console.log('子类 getAge:' + this.age);
    };
    Child.prototype.getMoney = function () {
        console.log('父类 getMoney:' + this.money);
    };
    return Child;
}(Parent));
var c = new Child('zhufeng', 10, 100);
c.getName();
c.name;
//c.age;
var Father = /** @class */ (function () {
    function Father() {
    }
    Father.getMyName = function () {
        return Father.myname;
    };
    Father.myname = 'zhufeng';
    return Father;
}());
console.log(Father.myname);
Father.getMyName();
//抽象类
/**
 * 抽象类是一种抽象的概念，无法被实例化,只能被继承
 * 抽象类里的方法是抽象的
 * 重写
 * 重载
 */
var Animal = /** @class */ (function () {
    function Animal() {
    }
    return Animal;
}());
var Cat = /** @class */ (function (_super) {
    __extends(Cat, _super);
    function Cat() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Cat.prototype.speak = function () {
        console.log('喵喵喵');
    };
    return Cat;
}(Animal));
var Dog = /** @class */ (function (_super) {
    __extends(Dog, _super);
    function Dog() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Dog.prototype.speak = function () {
        console.log('汪汪汪');
    };
    return Dog;
}(Animal));
